package icraf.carbon.gui.chart;

import static icraf.carbon.gui.MenuFactory.MenuProperty.CHART_FONT;
import static icraf.carbon.gui.MenuFactory.MenuProperty.CHART_SHAPE;
import icraf.common.gui.MenuGenerator.IconModel;

import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.JTabbedPane;

public class LabelSettingPanel extends JPanel{
	private static final long serialVersionUID = -4339756690912887507L;
	private FontChooser fontChooser;
	private ShapeSettingPanel shapeSettingPanel;
	
	public LabelSettingPanel () {
		
		this.setLayout(new BorderLayout());
		fontChooser = new FontChooser();
		shapeSettingPanel = new ShapeSettingPanel(ShapeSettingPanel.SHAPE_SETTING);
		JTabbedPane tabPane = new JTabbedPane();
		
		tabPane.addTab(CHART_FONT.getLabel(), CHART_FONT.getIcon(IconModel.ICON16), fontChooser);
		tabPane.addTab(CHART_SHAPE.getLabel(), CHART_SHAPE.getIcon(IconModel.ICON16), shapeSettingPanel);
		
		this.add(tabPane);
	}
	
	public void setLabelSetting(LabelFormat s) {
		fontChooser.setSettingFont(s.font);
		fontChooser.setSettingColor(s.fontColor);
		shapeSettingPanel.setSetting(s);
	}

	
	public LabelFormat getLabelSetting(LabelFormat s) {
		s = (LabelFormat) shapeSettingPanel.getSetting(s);
		s.font =fontChooser.getSettingFont();
		s.fontColor = fontChooser.getSettingColor();
		return s;
	}
	
	
}